﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Xml.Serialization;
using System.Xml.Schema;
using System.Xml;

namespace AgilePlannerDT.Persister.Impl.Socket
{
    public class DisconnectData : IXmlSerializable
    {
        protected int clientid;

        public DisconnectData()
            : this(0)
        {
        }

        public DisconnectData(int clientid)
        {
            this.clientid = clientid;
        }

        public int ClientID
        {
            get { return this.clientid; }
            set { this.clientid = value; }
        }

        #region IXmlSerializable Members

        public XmlSchema GetSchema()
        {
            return null;
        }

        public void ReadXml(XmlReader reader)
        {
            ClientID = int.Parse(reader.GetAttribute("clientid"));
        }

        public void WriteXml(XmlWriter writer)
        {
            writer.WriteStartElement("DisconnectData");
            writer.WriteAttributeString("clientid", ClientID.ToString());
            writer.WriteEndElement();
        }

        #endregion
    }
}
